﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="PayContract.aspx.cs" Inherits="Operator_PayContract" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <br />
    <asp:HyperLink ID="OperatorsLink" runat="server" NavigateUrl="~/Operator/OperatorPanel.aspx">Панель оперетора</asp:HyperLink>&nbsp;→&nbsp;
    <asp:Label ID="Label1" runat="server" Text="Оплата кредита" Font-Bold="true"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceContract"
        OnRowDataBound="GridView1_RowDataBound">
        <Columns>
            <asp:BoundField DataField="Кредит" HeaderText="Кредит" SortExpression="Кредит" />
            <asp:BoundField DataField="Сумма" HeaderText="Сумма" SortExpression="Сумма" />
            <asp:BoundField DataField="Срок" HeaderText="Срок" SortExpression="Срок" />
            <asp:BoundField DataField="Валюта" HeaderText="Валюта" SortExpression="Валюта" />
            <asp:BoundField HeaderText="Оплачено по основному долгу" />
            <asp:BoundField HeaderText="Оплачено по процентам" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceContract" runat="server" ConnectionString="<%$ ConnectionStrings:BankDBConnectionString %>"
        SelectCommand="SELECT Credit.Name AS Кредит, Contract.Amount AS Сумма, Contract.TermLength AS Срок, Currency.Name AS Валюта FROM Contract INNER JOIN Credit ON Contract.CreditId = Credit.CreditID INNER JOIN Currency ON Contract.CurrencyId = Currency.CurrencyID WHERE (Contract.ContractId = @ContractId)">
        <SelectParameters>
            <asp:SessionParameter Name="ContractId" SessionField="contractId" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Label ID="AmountLabel" runat="server" Text=""></asp:Label>
    <asp:TextBox ID="Amount" runat="server" Enabled="true" Text="0"></asp:TextBox>
    <asp:RequiredFieldValidator ControlToValidate="Amount" CssClass="failureNotification"
                    Display="Dynamic" ID="CurrencyUSDValidator" runat="server" ValidationGroup="CurrencyValidationGroup">*</asp:RequiredFieldValidator>
            

            <asp:RegularExpressionValidator ID="CurrencyUSDValidator1" ControlToValidate="Amount"
                    Text="Неправильный формат" ForeColor="Red" ValidationExpression="(^\d*\,?\d*[1-9]+\d*$)|(^[1-9]+\d*\,\d*$)" 
                    runat="server" ValidationGroup="CurrencyValidationGroup" />
    <br />
    <asp:Button ID="PayButton" runat="server" Text="Оплатить" OnClick="PayButton_Click" />
    <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>
</asp:Content>
